#include<bits/stdc++.h>
using namespace std;

int main() {
	freopen("poker.in", "r", stdin);
	freopen("poker.out", "w", stdout);

	int ans[5][14] = {0};
	int n;

	cin >> n;
	for (int i = 0 ; i < n ; i ++) {
		string t;
		cin >> t;
		int a, b;
		switch (t[0]) {
			case 'D':
				a = 1;
				break;
			case 'C':
				a = 2;
				break;
			case 'H':
				a = 3;
				break;
			default:
				a = 4;
				break;
		}
		if (t[1] == 'A')
			b = 1;
		else if (t[1] == 'T')
			b = 10;
		else if (t[1] == 'J')
			b = 11;
		else if (t[1] == 'Q')
			b = 12;
		else if (t[1] == 'K')
			b = 13;
		else
			b = t[1] - '0';
		ans[a][b]++;
	}
	int m = 0;
	for (int i = 1 ; i <= 4 ; i ++)
		for (int j = 1 ; j <= 13 ; j ++)
			if (ans[i][j] == 0)
				m ++;
	cout << m;

	return 0;
}
